package com.itheima.controller;

import com.itheima.pojo.ClazzOption;
import com.itheima.pojo.JobOption;
import com.itheima.pojo.Result;
import com.itheima.service.ClassService;
import com.itheima.service.EmpService;
import com.itheima.service.StuService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@Slf4j
@RestController
@RequestMapping("/report")
public class ReportController {
    @Autowired
     EmpService empService;
    @Autowired
    ClassService classService;
    @Autowired
    StuService stuService;

//    @GetMapping("/empJobData")
//    public Result getEmpJobData(){
//        log.info("统计各个职位的员工人数");
//        JobOption jobOption = empService.getEmpJobData();
//        return Result.success(jobOption);
//    }
    @GetMapping("/empJobData")
    public Result getEmpJobData() {
        JobOption jobOption =empService.getEmpJobData();
        return Result.success(jobOption);
    }

    @GetMapping("/empGenderData")
    public Result empGenderData(){
        log.info("统计性别");
        List<Map> mapList =empService.getgender();
        return Result.success(mapList);
    }

    @GetMapping("/studentCountData")
    public Result studentCountData(){
        log.info("统计班级人数");
        ClazzOption clazzOption = stuService.getStuCount();
        return Result.success(clazzOption);
    }

    @GetMapping("/studentDegreeData")
    public Result studentDegreeData(){
        log.info("统计学生学历");
        List<Map> mapList =stuService.getDegree();
        return Result.success(mapList);
    }
}
